<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

	<head>
		<meta charset="UTF-8">
		<title>管理员列表-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../static/css/font.css">
		<link rel="stylesheet" href="../../../static/css/weadmin.css">
		<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
		<script>
			$.get({
				url: "/admin/list",
				success: function (data) {
					$("#adminList").html(data)
				}
			})
		</script>
	</head>

	<body>
		<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">管理员管理</a>
        <a>
          <cite>管理员列表</cite></a>
      </span>
			<a class="layui-btn layui-btn-sm" style="margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
				<i class="layui-icon layui-icon-refresh"></i></a>
		</div>
		<div class="weadmin-body">
			<div class="layui-row">
				<form class="layui-form layui-col-md12 we-search">
					<div class="layui-inline">
						<input class="layui-input" placeholder="开始日" name="start" id="start">
					</div>
					<div class="layui-inline">
						<input class="layui-input" placeholder="截止日" name="end" id="end">
					</div>
					<div class="layui-inline">
						<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn" lay-submit="" lay-filter="search"><i class="layui-icon layui-icon-search"></i></button>
				</form>
			</div>
			<div class="weadmin-block">
				<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
				<button class="layui-btn" onclick="WeAdminShow('添加管理员','./add.html',600,370)"><i class="layui-icon layui-icon-add-circle-fine"></i>添加</button>
				<span class="fr" style="line-height:40px">共有数据：<span>[[${session.adminNum}]]</span> 条</span>
			</div>
			<table class="layui-table" id="adminList" th:fragment="adminList">
				<thead>
					<tr>
						<th>
							<div class="layui-unselect header layui-form-checkbox" lay-skin="primary">
                <i class="layui-icon layui-icon-ok"></i>
              </div>
						</th>
						<th>ID</th>
						<th>登录名</th>
						<th>手机</th>
						<th>邮箱</th>
						<th>角色</th>
						<th>加入时间</th>
						<th>状态</th>
						<th>操作</th>
				</thead>
				<tbody th:each="admin:${session.admins}">
					<tr th:data-id='${admin.id}'>
					<td>
						<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'>
							<i class="layui-icon layui-icon-ok"></i>
						</div>
					</td>
					<td>[[${admin.id}]]</td>
					<td>[[${admin.name}]]</td>
					<td>[[${admin.phone}]]</td>
					<td>[[${admin.email}]]</td>
					<td>[[${admin.roleName}]]</td>
					<td>[[${admin.joinTime}]]</td>
					<td class="td-status">
							<span th:if="${admin.status}==1" class="layui-btn layui-btn-normal layui-btn-xs">已启用</span>
							<span th:if="${admin.status}==0" class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled">已停用</span>
					</td>
					<td class="td-manage">
							<a th:if="${admin.status}==1" onclick="member_stop(this,'10001')" href="javascript:;" title="启用">
								<i class="layui-icon layui-icon-download-circle"></i>
							</a>
							<a th:if="${admin.status}==0" onclick="member_stop(this,'10001')" href="javascript:;" title="停用">
								<i class="layui-icon layui-icon-upload-circle"></i>
							</a>
						<a title="编辑" onclick="WeAdminEdit('编辑','./edit.html', this, 600, 400)" href="javascript:;">
						<i class="layui-icon layui-icon-edit"></i></a>
						<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
						<i class="layui-icon layui-icon-delete"></i>
						</a>
					</td>
					</tr>
				</tbody>
			</table>
			<div class="page">
				<div class="list" th:fragment="page">
					<span class="num" th:each="page:${session.adminPages}" th:uuid="${page}">[[${page}]]</span>
				</div>
			</div>
		</div>
		<script src="../../../static/lib/layui/layui.js" type="text/javascript"></script>
    <script src="../../../static/js/AdminDel.js" type="text/javascript"></script>
		<!--  查找用户-->
		<script>
			layui.use(['form', 'layer', "jquery"], function () {
				var form = layui.form,
						layer = layui.layer,
						$ = layui.jquery;

				//监听提交
				form.on('submit(search)', function (data) {
					var f = data.field;
					var username = f.username;
					var start = f.start;
					var end = f.end;
					if(username!="" || start!="" || end!="") {
						var find_data = {start: start,end: end, username: username}
						$.post({
							url: "/admin/find",
							contentType: "application/json;charset=UTF-8",
							data: JSON.stringify(find_data),
							success: function (data) {
								$("#adminList").html(data)
								$(".num[uuid=1]").addClass("current")
								$(".num[uuid=1]").siblings().removeClass("current")
							}
						})
					}
					return false;
				});
			});
		</script>


		<!--  换页-->
		<script>
			$(".num[uuid=1]").addClass("current")
			$(".num").click(function () {
				var page = $(this).attr("uuid")
				$.post({
					url: "/admin/page/"+page,
					contentType: "application/json;charset=UTF-8",
					success: function (data) {
						$("#adminList").html(data)
					},
					async: false
				})
				$(this).addClass("current")
				$(this).siblings().removeClass("current")
			})
		</script>
	</body>

</html>